<?php
defined('SYSPATH') OR die('No direct access allowed.');
/**
 * datapribadi.php
 * @author ranuandra
 *
 * 5 Jul 2012 13:38:43
 *
 * 
 */
$namabulan = array('', 'Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember');
$tgllist = array();
$blnlist = array();
$thnlist = array();

for($i = 1; $i <= 31; $i++)
{
	$tgllist[$i] = $i;
}
for($j = 1; $j <= 12; $j++)
{
	$blnlist[$j] = $namabulan[$j];
}
$thn = date("Y");
$thnlalu = $thn - 50;
for($k = $thn; $k >= $thnlalu; $k--)
{
	$thnlist[$k] = $k;
}
?>
    	<div class="span8">
                	<?php echo Form::open(URL::base().'home/save', array('class' => 'form-horizontal'));?>
                    <fieldset>
						<legend><span class="blue">Login</span> Info</legend>
                        <div class="control-group">
                        	<label class="control-label" for="Email">Alamat Emails</label>
                        	<div class="controls">
                        	<?php echo Form::input('email', $data->user->email, array('class' => 'tips', 'title' => 'Masukkan alamat email anda yang valid, selain untuk login juga kami gunakan untuk pemberitahuan selanjutnya <a href="test.php">coba</a>'))?>
                        	<?php 
                        	if(isset($errors['email']))
                        	{
								echo "<span class=\"error\">". $errors['email']."</span>";
                        	}
                        	?>
                        	</div>
                        </div>

                        <div class="control-group">
                        	<label class="control-label" for="Password">Password</label>
                        	<div class="controls">
                        	<?php echo Form::password('password', '', array('class' => 'tips', 'title'=>'Masukkan password anda minimal 6 karakter. Untuk keamanan lebih baik anda membuat password dengan kombinasi huruf dan angka'))?>
                        	
                        	<?php 
                        	if(isset($errors['_external']['password']))
                        	{
								echo "<span class=\"error\">".$errors['_external']['password']."</span>";
                        	}
                        	?>
                        	</div>
                        </div>
                        <div class="control-group">
                        	<label class="control-label" for="Confirm">Confirm Password</label>
                        	<div class="controls">
                        	<?php echo Form::password('password_confirm', '', array('class' => 'tips', 'title'=>'Masukkan sesuai dengan yang anda masukkan pada kolom password'))?>
                        	<?php 
                        	if(isset($errors['password_confirm']))
                        	{
								echo "<span class=\"error\">". $errors['password_confirm']."</span>";
                        	}
                        	?>
                        	</div>
                        </div>

                    </fieldset>
                    
                    
                    <fieldset>
                    	<legend><span class="blue">Personal</span> Info</legend>
                        <div class="control-group">
                        	<label class="control-label" for="Nama">Nama Lengkap</label>
                        	<div class="controls">
                        	<?php echo Form::input('nama_lengkap', $data->nama_lengkap, array('class' => 'tips', 'title'=>'Silahkan isi dengan nama lengkap anda sesuai dengan KTP'))?>
                        	<?php 
                        	if(isset($errors['nama_lengkap']))
                        	{
								echo "<span class=\"error\">".$errors['nama_lengkap']."</span>";
                        	}
                        	?>
                        	</div>
                        </div>
                        <div class="control-group">
                        	<label class="control-label" for="Tempat">Tempat Lahir</label>
                        	<div class="controls">
                        	<?php echo Form::input('tmp_lahir', $data->tmp_lahir, array('class' => 'tips', 'title'=>'Silahkan isi dengan tempat lahir anda sesuai dengan KTP'))?>
                        	<?php 
                        	if(isset($errors['tmp_lahir']))
                        	{
								echo "<span class=\"error\">". $errors['tmp_lahir']."</span>";
                        	}
                        	?>
                        	</div>
                        </div>
                        <div class="control-group">
                        	<label class="control-label" for="Tanggal">Tanggal Lahir</label>
                        	<div class="controls">
                        	<?php echo Form::select('tanggal', $tgllist, date("d", strtotime($data->tgl_lahir)), array('class' => 'input-small'))?> - 
                        	<?php echo Form::select('bulan', $blnlist, date("m", strtotime($data->tgl_lahir)), array('class' => 'input-small'))?> -
                        	<?php echo Form::select('tahun', $thnlist, date("Y", strtotime($data->tgl_lahir)), array('class' => 'input-small'))?>
                        	<?php 
                        	if(isset($errors['tgl_lahir']))
                        	{
								echo "<span class=\"error\">". $errors['tgl_lahir']."</span>";
                        	}
                        	?>
                        	</div>
                        </div>
                        <div class="control-group">
                         	<label class="control-label" for="Sex">Jenis Kelamin</label>
                         	<div class="controls">
                         		<div class="radio inline">
                        			<input type="radio" name="jenis_kelamin" value="Pria"/>Pria
                        		</div>
                        		<div  class="radio inline">
                        			<input type="radio" name="jenis_kelamin"  value="Wanita"/>Wanita
                        		</div>
                        	</div>
                        </div>
                         <div class="control-group">
                         	<label class="control-label" for="Tinggi">Tinggi</label>
                        	<div class="controls">
                        	<?php echo Form::input('tinggi', $data->tinggi, array('class' => 'tips input-small', 'title'=>'Silahkan isi tinggi anda dalam cm misal: 175'))?> (cm)
                        	</div>
                        </div>
                        <div class="control-group">
                         	<label class="control-label" for="Berat">Berat</label>
                        	<div class="controls">
                        	<?php echo Form::input('berat', $data->berat, array('class' => 'tips input-small', 'title'=>'Silahkan isi berat badan anda dalam kg misal: 75'))?> (kg)
                        	</div>
                        </div>
                         <div class="control-group">
                         	<label class="control-label" for="darah">Golongan Darah</label>
                        	<div class="controls">
	                         	<div  class="radio inline">
	                        		<input type="radio" name="golongan_darah" value="A" /> A
	                        	</div>
	                        	<div  class="radio inline">
	                        		<input type="radio" name="golongan_darah"  value="B" /> B
	                        	</div>
	                        	<div  class="radio inline">
	                        		<input type="radio" name="golongan_darah"  value="AB" /> AB
	                        	</div>
	                        	<div  class="radio inline">
	                        		<input type="radio" name="golongan_darah"  value="O" /> O
	                        	</div>
                        	</div>
                        </div>
                        <div class="control-group">
                        	<label class="control-label" for="Agama">Agama</label>
                        	<div class="controls">
                        	<?php echo Form::select('mstagama_id', $agamalist, $data->mstagama_id, array())?>
                        	</div>
                        </div>
                        <div class="control-group">
                        	<label class="control-label" for="Warga">Kewarganegaraan</label>
                        	<div class="controls">
                        	<?php echo Form::select('country_id', $countries, $data->country_id, array())?>
                        	</div>
                        </div>
                         <div class="control-group">
                         	<label class="control-label" for="Sex">Status Pernikahan</label>
                         	<div class="controls">
	                         	<div  class="radio inline">
	                        		<input type="radio" name="status_nikah" value="Menikah" class="status" />Menikah
	                        	</div>
	                        	<div  class="radio inline">
	                        		<input type="radio" name="status_nikah"  value="Belum Menikah" class="status"/>Belum Menikah
	                        	</div>
	                        	<div  class="radio inline">
	                        		<input type="radio" name="status_nikah"  value="Cerai Hidup" class="status"/>Cerai Hidup
	                        	</div>
	                        	<div  class="radio inline">
	                        		<input type="radio" name="status_nikah"  value="Cerai Meninggal" class="status"/>Cerai Meninggal
	                        	</div>
                        	</div>
                        </div>
                        <div class="control-group tglnikah">
                        	<label class="control-label" for="Telp">Tanggal Pernikahan</label>
                        	<div class="controls">
                        	<?php echo Form::select('tgl_nikah', $tgllist, date("d", strtotime($data->tglnikah)), array('class' => 'input-small'))?> - 
                        	<?php echo Form::select('bln_nikah', $blnlist, date("m", strtotime($data->tglnikah)), array('class' => 'input-small'))?> -
                        	<?php echo Form::select('thn_nikah', $thnlist, date("Y", strtotime($data->tglnikah)), array('class' => 'input-small'))?>
                        	</div>
                        </div>
                         <div class="control-group tglcerai">
                        	<label class="control-label" for="Telp">Tanggal Perceraian</label>
                        	<div class="controls">
                        	<?php echo Form::select('tgl_cerai', $tgllist, date("d", strtotime($data->tglcerai)), array('class' => 'input-small'))?> - 
                        	<?php echo Form::select('bln_cerai', $blnlist, date("m", strtotime($data->tglcerai)), array('class' => 'input-small'))?> -
                        	<?php echo Form::select('thn_cerai', $thnlist, date("Y", strtotime($data->tglcerai)), array('class' => 'input-small'))?>
                        	</div>
                        </div>
                        <div class="control-group jmlanak">
                        	<label class="control-label" for="Telp">Jumlah Anak</label>
                        	<div class="controls">
							<?php echo Form::input('jml_anak', $data->jml_anak, array('class' => 'tips input-small', 'title'=>'Masukan jumlah anak apabila mempunyai')) ?>
                        	</div>
                        </div>
                        <div class="control-group">
                        	<label class="control-label" for="Telp">Telp. Rumah</label>
                        	<div class="controls">
                        	<?php echo Form::input('phone', $data->phone, array('class' => 'tips input-small', 'title'=>'Masukan no. telp. yang bisa dihubungi'))?>
                        	</div>
                        </div>
                        <div class="control-group">
                        	<label class="control-label" for="Mobile">Handphone</label>
                        	<div class="controls">
                        	<?php echo Form::input('mobilephone', $data->mobilephone, array())?>
                        	</div>
                        </div>
                       
                    </fieldset>
                    <fieldset>
                    	<legend><span class="blue">Info</span> Alamat <em> Sesuai dengan KTP</em></legend>
                        <div class="control-group">
                        	<label class="control-label" for="NoKtp">No KTP</label>
                        	<div class="controls">
                        	<?php echo Form::input('no_ktp', $data->no_ktp, array()) ?>
                        	<?php 
                        	if(isset($errors['no_ktp']))
                        	{
								echo "<span class=\"error\">". $errors['no_ktp']."</span>";
                        	}
                        	?>
                        	</div>
                        </div> 
                         <div class="control-group">
                         	<label class="control-label" for="Alamat">Alamat</label>
                         	<div class="controls">
                         	<?php echo Form::input('alamat_ktp', $data->alamat_ktp, array('class' => 'tips', 'title'=>'Masukkan Alamat anda sesuai dengan KTP', 'id' => 'alamat_ktp')) ?>
                        	<?php 
                        	if(isset($errors['alamat_ktp']))
                        	{
								echo "<span class=\"error\">". $errors['alamat_ktp']."</span>";
                        	}
                        	?>
                        	</div>
                        </div> 
                         <div class="control-group">
                         	<label class="control-label" for="Alamat">RT/RW</label>
                         	<div class="controls">
                         	<?php echo Form::input('rt_ktp', $data->rt_ktp, array('class' => 'tips input-small', 'title'=>'', 'id' => 'rt_ktp')) ?>
                        	<?php 
                        	if(isset($errors['alamat_ktp']))
                        	{
								echo "<span class=\"error\">". $errors['rt_ktp']."</span>";
                        	}
                        	?>
                        	</div>
                        </div> 
                         <div class="control-group">
                         	<label class="control-label" for="Alamat">Kelurahan</label>
                         	<div class="controls">
                         	<?php echo Form::input('kelurahan_ktp', $data->kelurahan_ktp, array('class' => 'tips', 'title'=>'', 'id' => 'kelurahan_ktp')) ?>
                        	<?php 
                        	if(isset($errors['alamat_ktp']))
                        	{
								echo "<span class=\"error\">". $errors['kelurahan_ktp']."</span>";
                        	}
                        	?>
                        	</div>
                        </div> 
                         <div class="control-group">
                         	<label class="control-label" for="Alamat">Kecamatan</label>
                         	<div class="controls">
                         	<?php echo Form::input('kecamatan_ktp', $data->kecamatan_ktp, array('class' => 'tips', 'title'=>'','id' => 'kecamatan_ktp')) ?>
                        	<?php 
                        	if(isset($errors['alamat_ktp']))
                        	{
								echo "<span class=\"error\">". $errors['kecamatan_ktp']."</span>";
                        	}
                        	?>
                        	</div>
                        </div> 
      
                        <div class="control-group">
                         	<label class="control-label" for="Kota">Kota / Kabupaten</label>
                         	<div class="controls">
                        	<?php echo Form::input('kota_ktp', $data->kota_ktp, array('id' => 'kecamatan_ktp')) ?>
                        	<?php 
                        	if(isset($errors['kota_ktp']))
                        	{
								echo "<span class=\"error\">". $errors['kota_ktp']."</span>";
                        	}
                        	?>
                        	</div>
                        </div>  
                         <div class="control-group">
                        	<label class="control-label" for="Kodepos">Kodepos</label>
                        	<div class="controls">
                        	<?php echo Form::input('kodepos_ktp', $data->kodepos_ktp, array('class' => 'input-small', 'id' => 'kodepos_ktp')) ?>
                        	<?php 
                        	if(isset($errors['kodepos_ktp']))
                        	{
								echo "<span class=\"error\">". $errors['kodepos_ktp']."</span>";
                        	}
                        	?>
                        	</div>
                        </div> 
                         <div class="control-group">
                         	<label class="control-label" for="Provinsi">Provinsi</label>
                         	<div class="controls">
                        	<?php echo Form::input('propinsi_ktp', $data->propinsi_ktp, array('id' => 'propinsi_ktp')) ?>
                        	<?php 
                        	if(isset($errors['propinsi_ktp']))
                        	{
								echo "<span class=\"error\">". $errors['propinsi_ktp']."</span>";
                        	}
                        	?>
                        	</div>
                        </div>                    
                    </fieldset>
                     <fieldset>
                    	<legend><span class="blue">Alamat Domisili</span> <em> Alamat terbaru</em></legend>
                        <div class="control-group">
                        	<label class="control-label" for="NoKtp"></label>
                        	<div class="controls">
	                    		<div  class="radio inline">
	                    			<?php echo Form::checkbox('alamatsama', 0, false, array('id' => 'sameaddress'))?>
	                        		Sama Dengan KTP
	                        	</div>
                        	</div>
                        </div> 
                        <div id="domicileform">
                         <div class="control-group">
                         	<label class="control-label" for="Alamat">Alamat</label>
                         	<div class="controls">
                         	<?php echo Form::input('alamat', $data->alamat, array('class' => 'tips', 'title'=>'Masukkan Alamat terbaru', 'id' => 'alamat')) ?>
                        	<?php 
                        	if(isset($errors['alamat_ktp']))
                        	{
								echo "<span class=\"error\">". $errors['alamat']."</span>";
                        	}
                        	?>
                        	</div>
                        </div> 
                         <div class="control-group">
                         	<label class="control-label" for="Alamat">RT/RW</label>
                         	<div class="controls">
                         	<?php echo Form::input('rt', $data->rt, array('class' => 'tips input-small', 'title'=>'', 'id' => 'rt')) ?>
                        	<?php 
                        	if(isset($errors['alamat_ktp']))
                        	{
								echo "<span class=\"error\">". $errors['rt']."</span>";
                        	}
                        	?>
                        	</div>
                        </div> 
                         <div class="control-group">
                         	<label class="control-label" for="Alamat">Kelurahan</label>
                         	<div class="controls">
                         	<?php echo Form::input('kelurahan', $data->kelurahan, array('class' => 'tips', 'title'=>'', 'id' => 'kelurahan')) ?>
                        	<?php 
                        	if(isset($errors['alamat_ktp']))
                        	{
								echo "<span class=\"error\">". $errors['kelurahan']."</span>";
                        	}
                        	?>
                        	</div>
                        </div> 
                         <div class="control-group">
                         	<label class="control-label" for="Alamat">Kecamatan</label>
                         	<div class="controls">
                         	<?php echo Form::input('kecamatan', $data->kecamatan, array('class' => 'tips', 'title'=>'', 'id' => 'kecamatan')) ?>
                        	<?php 
                        	if(isset($errors['alamat']))
                        	{
								echo "<span class=\"error\">". $errors['kecamatan']."</span>";
                        	}
                        	?>
                        	</div>
                        </div> 
      
                        <div class="control-group">
                         	<label class="control-label" for="Kota">Kota / Kabupaten</label>
                         	<div class="controls">
                        	<?php echo Form::input('kota', $data->kota, array('id' => 'kota')) ?>
                        	<?php 
                        	if(isset($errors['kota_ktp']))
                        	{
								echo "<span class=\"error\">". $errors['kota']."</span>";
                        	}
                        	?>
                        	</div>
                        </div>  
                         <div class="control-group">
                        	<label class="control-label" for="Kodepos">Kodepos</label>
                        	<div class="controls">
                        	<?php echo Form::input('kodepos', $data->kodepos, array('class' => 'input-small', 'id' => 'kodepos')) ?>
                        	<?php 
                        	if(isset($errors['kodepos_ktp']))
                        	{
								echo "<span class=\"error\">". $errors['kodepos']."</span>";
                        	}
                        	?>
                        	</div>
                        </div> 
                         <div class="control-group">
                         	<label class="control-label" for="Provinsi">Provinsi</label>
                         	<div class="controls">
                        	<?php echo Form::input('propinsi', $data->propinsi, array('id' => 'propinsi')) ?>
                        	<?php 
                        	if(isset($errors['propinsi']))
                        	{
								echo "<span class=\"error\">". $errors['propinsi']."</span>";
                        	}
                        	?>
                        	</div>
                        </div>   
                        </div>                 
                    </fieldset>
                    <fieldset>
                    	<legend></legend>
                    	<div class="control-group">
                    		<label class="control-label" for="Captcha">&nbsp;</label>
                    		<div class="controls">
                    		<?php 
                    			echo Form::input('captcha', '', array());
                    			if(isset($errors['captcha']))
                    			{
                    				echo "<span class=\"error\">". $errors['captcha']."</span>";
                    			}
                    		?>
                    		<p class="note">Masukan kode dibawah</p>
                    		</div>
                    		
                    	</div>
                    	<div class="control-group">
                    		<label class="control-label" for="Bidang">&nbsp;</label>
                    		
                    		<div class="controls">
                    		<?php 
                    			if(isset($captcha))
                    			{
                    				echo $captcha->render();
                    			}

                    		?>
                    		
                    		</div>
                    	</div>
                    </fieldset>
                    <fieldset>
                    	<legend></legend>
                    	<div class="control-group">
                    		<label class="control-label" for="Bidang">&nbsp;</label>
                    		<div class="controls">
	                    		<label class="checkbox">
	                        	<?php echo Form::checkbox("term", "1", "", array())?> Dengan ini saya menyatakan bahwa data/keterangan yang saya berikan di atas, benar isinya.<br>Apabila dikemudian hari diketahui bahwa data/keterangan yang diberikan tidak sesuai dengan kenyataan/tidak benar, maka saya bertanggung jawab penuh atas akibatnya dan pihak Perusahaan berhak memutuskan hubungan kerja tanpa syarat dan atau menuntut pelamar sesuai dengan hukum yang berlaku.
	                        	</label>
                        	</div>
                    	</div>
                    </fieldset>
                    <fieldset>
                    	<legend></legend>
	                    <div class="form-actions">
	                    	<button type="submit" class="btn btn-primary">Register</button>
	                    	<button class="btn">Cancel</button>
	                    </div>
                    </fieldset>
                    
                    <?php echo Form::close();?>
              </div>
 <script type="text/javascript">
$(document).ready(function() {
	$('.tglnikah').hide();
	$('.tglcerai').hide();
	$('.jmlanak').hide();
	$('#btnsave').attr("disabled", "disabled");
	$('.status').live('change', function(){
		var sts = $(this).val();
		if(sts != "Belum Menikah")
		{
			if(sts == "Menikah")
			{
				$('.tglnikah').show();
				$('.jmlanak').show();
				$('.tglcerai').hide();
			}
			else if(sts == "Cerai Hidup")
			{
				$('.tglnikah').hide();
				$('.tglcerai').show();
				$('.jmlanak').show();
			}
			else if(sts == "Cerai Meninggal")
			{
				$('.tglnikah').hide();
				$('.tglcerai').hide();
				$('.jmlanak').show();
			}
		}
		else
		{
			$('.tglnikah').hide();
			$('.tglcerai').hide();
			$('.jmlanak').hide();
		}
	});

	$("#ac1").autocomplete('<?php echo URL::base()?>pendidikan/search', {
        minChars: 3,
    });
	
	$('#sameaddress').attr('checked', true);
	$('#domicileform').hide();
	
    $('#sameaddress').live('change', function () {
        if($('#sameaddress').is(':checked'))
        {
            $('#domicileform').hide();
            $('#alamat').val($('#alamat_ktp').val());
            $('#rt').val($('#rt_ktp').val());
            $('#kelurahan').val($('#kelurahan_ktp').val());
            $('#kecamatan').val($('#kecamatan_ktp').val());
            $('#kota').val($('#kota_ktp').val());
            $('#propinsi').val($('#propinsi_ktp').val());
            $('#kodepos').val($('#kodepos_ktp').val());
        }
        else
        {
            $('#domicileform').show();
            $('#alamat').val('');
            $('#rt').val('');
            $('#kelurahan').val('');
            $('#kecamatan').val('');
            $('#kota').val('');
            $('#propinsi').val('');
            $('#kodepos').val('');
        }
    
    });

    $('#setuju').live('change', function (){
		if($('#setuju').is(':checked'))
		{
			$('#btnsave').removeAttr("disabled");
		}
    	else
    	{
    		$('#btnsave').attr("disabled", "disabled");
    	}
        
     });

    $('#pendidikan').live('change', function(){
		var id = $(this).val();
		$('#jurusan').load('<?php echo URL::base()?>home/jurusan/' + $(this).val(), function(response, status, xhr){
			if(status=="success")
			{
				//$('.horloader').remove();
				//$('select.seltype').multiselect();
			}
		});
    });
	
});
</script>